/**
 * Base64
 * 
 * 05/12/2013
 * 
 * Copyright GPL
 */
package com.jtmproject.javiertejedor.cyphers;

import org.apache.commons.codec.binary.Base64;

/**
 * this class encrypts and decrypts with Base64 Cypher
 * 
 * @author Javier Tejedor
 * @thanks http://javarevisited.blogspot.com.es/2012/02/
 * how-to-encode-decode-string-in-java.html
 */
public class Base64Cypher implements Encryption {

	/* (non-Javadoc)
	 * @see com.jtmproject.javiertejedor.cyphers.Encryption#encrypt(java.lang.String)
	 */
	@Override
	public String encrypt(String textToEncrypt) {
		
		return new String(Base64.encodeBase64(textToEncrypt.getBytes()));
	}

	/* (non-Javadoc)
	 * @see com.jtmproject.javiertejedor.cyphers.Encryption#decrypt(java.lang.String)
	 */
	@Override
	public String decrypt(String textoToDecrypt) {
		
		return new String(Base64.decodeBase64(textoToDecrypt.getBytes()));
	}

}
